#include "AdvancedAI.h"
#include "params.h"
#include "userAPI.h"
#include "params.h"

namespace AdvanceAI_ns {

/*
	Implementation of AdvancedAI architecture.
 */

vector<GeneralType> AdvanceAI::pickGeneral(
	int numGeneral, 
	GeneralType yourType, 
	vector<Pair> &pos, 
	vector<SoldierType> &soldierType, 
	vector<int> &numSoldier)
{
	//	pick up generals by UserAI's implementation
	//	TODO pick up generals in another way?
	LOG << "picking up generals" << endl;
	vector<GeneralType> ret = UserAI::pickGeneral(numGeneral, yourType, pos, soldierType, numSoldier);
	LOG << "picking up generals done" << endl;
	return ret;
}

vector<ActionBase*> AdvanceAI::getAction(GameInfo* game)
{
	UserAPI api(game, my_id);
	manager.get_api() = api;

	LOG << "AdvanceAI::getAction called: General = " << api.GetCntArmy()->general->type << endl;
	if (!manager.isInitialized())
		manager.initialize(this);

	vector<ActionBase*> ret = manager.act();
	LOG << "AdvanceAI::getAction done" << endl;
	return ret;
}


}